package com.example.demo.common.exception;

import com.example.demo.common.code.ErrorCode;
import com.example.demo.common.code.PlatStandardCode;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

@Data
@ToString
public class LoginException extends YuException implements Serializable {

    public LoginException(String basicCode, String basicDesc) {
        super(basicCode,basicDesc);
    }



    public static LoginException build(PlatStandardCode code)
    {
        return new LoginException(code.getBasicCode(),code.getBasicDesc());
    }
    public static LoginException build(PlatStandardCode code,String msg)
    {
        return new LoginException(code.getBasicCode(), msg);
    }
    public static LoginException build(String msg)
    {
        return new LoginException("自定义异常",msg);
    }
    public static LoginException build(ErrorCode errorCode){
        return new LoginException(errorCode.getCode(),errorCode.getMsg());
    }
}
